import json

from rest_framework import serializers
from tag.models import Tags


class TagsSerializer(serializers.ModelSerializer):
    # def is_exist(self, attrs):
    #     name = attrs['name']
    #     tags = Tags.objects.get(pk=name)
    #     if tags:
    #         return True
    #     return False
    clout = serializers.IntegerField(read_only=True)

    def create(self, validated_data):
        return super().create(validated_data)

    class Meta:
        model = Tags
        fields = '__all__'


class TagsReadOnly(serializers.ModelSerializer):
    class Meta:
        model = Tags
        fields = ['name']
